program POS;

uses
  Forms,
  Windows,
  SysUtils,
  UntMain in 'form\UntMain.pas' {FrmMain},
  UntLogin in 'form\UntLogin.pas' {FrmLogin},
  UntUser in 'obj\UntUser.pas',
  UntUserDB in 'db\UntUserDB.pas',
  unt_File in 'com\unt_File.pas',
  UntConf in 'com\UntConf.pas',
  UntSale in 'form\UntSale.pas' {frmSale},
  BaseFrm in 'com\BaseFrm.pas' {BaseForm},
  defineConst in 'com\defineConst.pas',
  MultiLang in 'com\MultiLang.pas',
  UntDMDB in 'com\UntDMDB.pas' {DMMySQL: TDataModule},
  UntParchase in 'form\UntParchase.pas' {frmParchase},
  UntSaleList in 'form\UntSaleList.pas' {FrmSaleList},
  UntSaleObj in 'obj\UntSaleObj.pas',
  UntSelSalesmen in 'form\UntSelSalesmen.pas' {FrmSelSalesmen},
  UntVIPObj in 'obj\UntVIPObj.pas',
  UntReturn in 'form\UntReturn.pas' {FrmReturn},
  UntPayment in 'form\UntPayment.pas' {frmPayment},
  UntIDGenerator in 'obj\UntIDGenerator.pas',
  UntGoodsInfoMng in 'form\UntGoodsInfoMng.pas' {frmGoodsInfoMng},
  UntSearch in 'com\UntSearch.pas',
  UntGoodsInfo in 'form\UntGoodsInfo.pas' {FrmGoodsInfo},
  UntSalermenDB in 'db\UntSalermenDB.pas',
  UntSaleInfo in 'form\UntSaleInfo.pas' {frmSaleInfo},
  UntSaleInfoMng in 'form\UntSaleInfoMng.pas' {frmSaleInfoMng},
  UntUserMng in 'form\UntUserMng.pas' {frmUserMng},
  UntAddUser in 'form\UntAddUser.pas' {frmAddUser},
  UntChangePwd in 'form\UntChangePwd.pas' {frmChangePwd},
  UntKindMng in 'form\UntKindMng.pas' {frmKindMng},
  UntKindInfo in 'obj\UntKindInfo.pas',
  UntParchaseReport in 'form\UntParchaseReport.pas' {FrmParchaseReport},
  UntKindSelect in 'form\UntKindSelect.pas' {frmKindSel},
  UntDBToExcel in 'obj\UntDBToExcel.pas',
  UntReturns in 'form\UntReturns.pas' {frmReturns},
  UntReturnsReport in 'form\UntReturnsReport.pas' {FrmReturnsReport},
  UntSaleExcelReport in 'obj\UntSaleExcelReport.pas',
  UntExcel in 'com\UntExcel.pas',
  UntBrandInfo in 'form\UntBrandInfo.pas' {FrmBrandInfo},
  UntParchaseExcelReport in 'obj\UntParchaseExcelReport.pas',
  UntImportExcel in 'form\UntImportExcel.pas' {FrmImportExcel},
  UntLoadExcel in 'obj\UntLoadExcel.pas',
  UntMatchingData in 'form\UntMatchingData.pas' {FrmMatching},
  UntTableInfo in 'obj\UntTableInfo.pas',
  UntSaleAllExcelReport in 'obj\UntSaleAllExcelReport.pas',
  UntMulSearch in 'com\UntMulSearch.pas' {FrmMulSearch},
  UntStoreGoods in 'form\UntStoreGoods.pas' {frmStoreGoods},
  UntStoreGoodsInfoDB in 'db\UntStoreGoodsInfoDB.pas',
  UntStoreCodeDB in 'db\UntStoreCodeDB.pas',
  UntReturnsExcelReport in 'obj\UntReturnsExcelReport.pas',
  UntDiscountInfoMng in 'form\UntDiscountInfoMng.pas' {FrmDiscountInfoMng},
  UntDiscountInfo in 'form\UntDiscountInfo.pas' {FrmDiscountInfo},
  UntDiscountPlan in 'form\UntDiscountPlan.pas' {FrmDesicountPlan},
  UntDiscountSelect in 'form\UntDiscountSelect.pas' {frmDiscountSelect},
  UntSaleDouDis in 'obj\UntSaleDouDis.pas',
  UntStocktakingMng in 'form\UntStocktakingMng.pas' {frmStocktakingMng},
  UntStocktaking in 'form\UntStocktaking.pas' {frmStocktaking},
  UntStocktakingCompare in 'form\UntStocktakingCompare.pas' {frmCompare},
  UntSaleCache in 'form\UntSaleCache.pas' {frmSaleCache},
  UntSaleInDesc in 'form\UntSaleInDesc.pas' {frmSaleInDesc},
  UntBrandDB in 'db\UntBrandDB.pas',
  UntStocktakingUpdate in 'form\UntStocktakingUpdate.pas' {frmStocktakingUpdate},
  UntSaleDetailReport in 'form\UntSaleDetailReport.pas' {frmSaleDetailReport},
  UntDBGridEhToExcel in 'com\UntDBGridEhToExcel.pas',
  UntSaleDetailExcelReport in 'obj\UntSaleDetailExcelReport.pas',
  UntTableInfo_Dis in 'obj\UntTableInfo_Dis.pas';

{$R *.res}

var
  handle:DWORD;

begin
  handle := CreateMutex(nil, false, 'bmt_POS');
  if GetLastError = ERROR_ALREADY_EXISTS then
  begin
    SetForegroundWindow(handle);
    Halt(0);
  end;
  KFile := TKFile.Create();
  try
    //TBackupDB.backupDB;
    Application.Initialize;
    Application.MainFormOnTaskbar := True;
    Application.Title := 'POS';
    Application.CreateForm(TDMMySQL, DMMySQL);
  if not DMMySQL.LinkDB then
    begin
      Application.Terminate;
      Exit;
    end;
    DMMySQL.backupDB;
    if TFrmLogin.loginOK then
    begin
      Application.CreateForm(TFrmMain, FrmMain);
      Application.Run;
    end;
  finally
    FreeAndNil(KFile);
  end;
end.
